Florian Müllner [Wed, 20 Nov 2019 21:15:26 +0000 (22:15 +0100)]
dateMenu: Try harder finding a reasonable weather location name
Weather stations can have unwieldy long names, which don't fit the
limited space we have available. City names are usually more suitable,
so use the name of the nearest city instead if possible.
Florian Müllner [Wed, 20 Nov 2019 21:21:48 +0000 (22:21 +0100)]
dateMenu: Add some spacing between weather header and location
In case of a very long location name, the label may take up all
available space. Make sure there is at least some spacing between
header and location in that case.
Florian Müllner [Wed, 20 Nov 2019 20:48:03 +0000 (21:48 +0100)]
dateMenu: Bottom-align weather title/location
The two labels use different font sizes, so they don't align properly.
Unfortunately we don't have BASELINE alignment in Clutter, but at least
END comes closer than the default FILL.
Commit c899453800f11 lifted the requirement of switcher keybindings
to contain a modifier, however it is currently only possible to
finish it by letting it time out.
Improve that by also accepting space/enter key presses to confirm the
selection immediately.
Jonas Dreßler [Fri, 22 Nov 2019 19:56:30 +0000 (20:56 +0100)]
switcherPopup: Use roundtrip time when the popup is modifier-less
The noModsTimeout obviously finishes inside a timeout callback, which
means `global.get_current_time()` might return Clutter.CURRENT_TIME (ie.
0) when called inside it, because it's not called while handling an
event. This means when switching apps or activating a window, the
timestamp passed to `activate_window` may be 0, which is the reason why
the altTab switcher is currently broken when using modifier-less
keybindings.
Fix that by using `meta_display_get_current_time_roundtrip`, which
always return a valid timestamp, instead of
`shell_global_get_current_time`.
pageIndicators: Redesign and add position-based animation
Remove setCurrentPage() function, introduce setCurrentPosition() instead,
which allows to have fractional positions.
Make inactive dots smaller, filled and partially transparent, as opposed to
larger and fully opaque active dot. Make dots smaller overall, remove
borders. Interpolate each dot between active and inactive state based on
scroll position.
Florian Müllner [Thu, 21 Nov 2019 22:40:02 +0000 (23:40 +0100)]
switcherPopup: Show immediately on second key press
We slightly delay showing the switcher popup to avoid flashing it
briefly in the common case of quickly switching back-and-forth
between two windows.
However some users perceive this delay as slowness. Address this by
showing the popup immediately when another key press is consumed
(that is, a key like Tab is pressed).
Jonas Dreßler [Sun, 17 Nov 2019 15:24:52 +0000 (16:24 +0100)]
mpris: Use a scope specific message instead of a global one
Since the mpris implementation of the notification tray supports showing
multiple notification (one for each player), it doesn't make sense to
have only one global property to store the message, since that only
allows referencing one message at a time.
Instead, handle the MediaMessages completely inside the scope of
`_addPlayer()`, this should allow showing more than one message again,
which broke with commit 4dc44304dff2974d3b026b5aa58e0d5c25d38216 [1].
Jonas Dreßler [Sun, 17 Nov 2019 13:35:42 +0000 (14:35 +0100)]
messageList: Don't include message actor in error message
Because the message actor could also be undefined or a already
deallocated ClutterActor, we sometimes fail to show the error message
and get an error from Gjs instead.
So make sure we always log the proper error message and just leave out
the actor.
folderView: Reset schemas before removing the folder
When removing the last icon of a folder, FolderView first removes
the folder from org.gnome.desktop.app-folders.folder-children, then
proceeds to reset all its keys, which removes the relocatable schema.
That order of operations turns out to be problematic. Removing the
folder from 'folder-children' destroys the folder icon, which in turn
destroys the folder view, which throws a load of warnings in the
journal.
Fix that by removing the folder after resetting the schema keys. In
fact, what we're doing here is not using 'this' anymore.
The variable that holds the list of application icons is
called 'newApps', but that technically was never true,
since we only create new app icons when necessary.
allView, frequentView: Only create icons when necessary
The views (AllView and FrequentView) build a list of all applications
they contain. BaseView then diffs between what's currently added, and
what needs to be added, and removed.
This approach has a problem though: creating an AppIcon or a FolderIcon
connects to various signals, and we confuse the garbage collector.
When building the list of applications, instead of always creating new
icons, try to use already existing icons first.
Philip Chimento [Tue, 19 Nov 2019 21:31:57 +0000 (13:31 -0800)]
dateMenu: Skip weather forecast if not valid
GWeather.Info.get_value_update() may indicate that the forecast is not
valid, or it may return a timestamp of 0 to indicate the information has
never been updated. In both of these cases, skip creating a widget for
it, as the information will not be accurate.
Philip Chimento [Tue, 19 Nov 2019 21:15:34 +0000 (13:15 -0800)]
dateMenu: Format weather forecast times without AM/PM
If the clock is set to 12h, the AM/PM in the weather forecast times
should be clear from the context, because they are the immediately
following hours. This makes it less likely that the times will be
ellipsized (in which case the AM/PM wouldn't be shown anyway.)
Get rid of leftover empty space from the application menu panel
button, that was used by the spinner actor, which remained visible
even after the spinner had stopped.
Florian Müllner [Sat, 16 Nov 2019 12:48:35 +0000 (13:48 +0100)]
keyboard: Try harder to find a matching layout
While we support a reasonable list of layouts nowadays, we don't
include many variants like `fr+oss`. Instead of directly falling
back to the `us` layout, try stripping the variant first, as the
base layout is likely closer to the expectation than `us`.
Jonas Dreßler [Sun, 23 Jun 2019 11:11:58 +0000 (13:11 +0200)]
polkitAgent: Cancel session after disconnecting signal handlers
When cancelling the PolkitAgent session before disconnecting the signal
handlers, we receive a "completed" signal where `gained_authorization`
is set to FALSE, which means we show an error message inside
`_onSessionCompleted()`.
This in turn means we show an error message every time we cancel a
session. In practice this wasn't really relevant so far since we only
destroyed the session when an actual error occurred before. Now that the
dialog supports empty passwords, we also call `_destroySession()` when
the user changes and no longer has a password set, and in this case we
want to cancel the current session without showing an error message.
So to fix this, disconnect the signal handlers before cancelling the
session, which makes sure we don't receive the last "completed" signal
in case we cancelled the session ourselves. This change also allows
removing `this._wasDismissed`.
Joaquim Rocha [Sun, 23 Jun 2019 10:32:35 +0000 (12:32 +0200)]
polkitAgent: Use dialog as confirmation when the user has no password
When a user has no password and a polkit authentication is started,
instead of blindly initiating the admin session, show the regular
"Authentication Requested" dialog (but without the password entry). This
makes sure that the user's admin session is only effectively started
after the user chooses to proceed with the authentication, which
provides an extra confirmation step that can be vital for critical
tasks.
To do this, we show the dialog inside `_onUserChanged()` right after the
dialog was created instead of calling `performAuthentication()` from
`_onInitiate()`. The bug mentioned in `_onInitiate()` is no longer an
issue since we show the dialog in all cases now anyway.
Ideally we should use a different wording than "authentication" when the
user has no password set, and use "confirmation" instead. However polkit
already sends the requests with such messages (e.g. "Authentication is
required to configure software repositories"), and it's important to
show those to the user, so this patch keeps the regular wording.
Jonas Dreßler [Thu, 14 Nov 2019 17:51:01 +0000 (18:51 +0100)]
polkitAgent: Only reset UI on session resets while opened
Since `_destroySession()` is not only called before we try to initiate a
new authentication session with Polkit, but also when the dialog is
closed, it's currently possible that key focus is grabbed by the close
button after the dialog was dismissed and hidden. This is causing a bug
where after dismissing one of multiple queued dialogs, key focus goes
away and keyboard navigation with the new dialog is impossible.
Fix this by only resetting the UI of the dialog if the dialog is still
opened/visible at that point.
Modifying variables from an outer scope in functions created in a loop
is considered problematic by eslint, because the variable value in the
resulting closure is often not what the coder intended.
In this particular case however, the scoping is correct, so add a comment
to disable the rule locally.
Florian Müllner [Tue, 20 Aug 2019 02:24:37 +0000 (04:24 +0200)]
style: Allow lonely ifs where appropriate
We now have a lint rule to disallow lonely ifs, however there are
cases where the "lonely" part mirrors code from the preceding if
clause. Opt out of the lint rule in those cases.
Florian Müllner [Tue, 20 Aug 2019 20:18:04 +0000 (22:18 +0200)]
lint: Disable eqeqeq in legacy configuration
Using type-safe comparisons is a good idea, but after not doing so
for a decade, there's too much existing code around for flipping
the switch right away.
Florian Müllner [Tue, 20 Aug 2019 21:43:54 +0000 (23:43 +0200)]
cleanup: Require "dangling" commas
Since ES5, trailing commas in arrays and object literals are valid.
We generally haven't used them so far, but they are actually a good
idea, as they make additions and removals in diffs much cleaner.
Florian Müllner [Mon, 19 Aug 2019 19:06:04 +0000 (21:06 +0200)]
cleanup: Use object shorthand where possible
ES6 allows to omit property names where they match the name of the
assigned variable, which makes code less redunant and thus cleaner.
We will soon enforce that in our eslint rules, so make sure we use
the shorthand wherever possible.
Florian Müllner [Tue, 20 Aug 2019 02:10:46 +0000 (04:10 +0200)]
cleanup: Avoid "lonely" ifs where it makes sense
If an else block only contains an if statement, the two can be
combined into an if-else block, which cuts down on indentation
and usually helps legibility.
There are exceptions (for instance where the outer if and else
blocks are mirrored), but where it makes sense, change the code
to avoid lonely ifs.
Florian Müllner [Tue, 20 Aug 2019 00:24:28 +0000 (02:24 +0200)]
jsParse: Unnest functions
Nesting functions can be helpful for private helper functions, but
here they are accessing some variables from the outer scope and
shadowing others. Split them out to avoid any ambiguity.
allView: Ensure event blocker is reactive before popup is open
The event blocker in AllView is responsible for stealing click events
from the icon grid and closing the folder popup. The event blocker is
kept unreactive when no folder popup is visible, and it's made reactive
as a response to the 'open-state-changed' signal.
Using this signal, though, is problematic. When opening an app folder,
the icon grid first opens space for the folder to fit in; during this
period, it's possible to click on another folder icon, and break the
icon grid state.
Make sure the event blocker is reactive immediately after clicking on
a folder icon.
Florian Müllner [Wed, 6 Nov 2019 11:05:56 +0000 (12:05 +0100)]
js: Fix alignment
The old StBin alignment properties defaulted to MIDDLE, while the
ClutterActor properties use FILL. Fix the resulting fallout by
setting the alignment explicitly where necessary.
calendar: Define EventSourceBase and extend EventSource's
Objects implementing EventSource should have some mandatory methods and
properties, we can ensure this by defining an EventSourceBase abstract
class.
So inherit EmptyEventSource and DBusEventSource from it making sure that
they implement all the needed methods, using native properties and
replacing the 'notify::*' fake signal emissions with proper object
notifications.
modemManager: Define ModemBase GObject class for modems
Use GObject based objects for ModemGsm, ModemCdma and BroadbandModem.
This allows to define a base class that we can use to natively define
properties and notify property changes.
We can now remove the "fake" notify signals with proper properties
notifications.
background: Inherit Animation from GnomeDesktop.BGSlideShow
Animation background is just wrapping a native GnomeDesktop BGSlideShow
object, so instead of using composition we can now just inherit from the
native GObject, re-using native properties when possible, and avoiding
to keep an extra wrapper to the bg file.
Resizing effects are more finicky as other effects, as the actual
animation is delayed until we receive the ::size-changed signal.
However that signal may never be emitted if the window is destroyed
just after starting the size-change effect, in which case the effect
is never completed, blocking mutter from destroying the corresponding
window actor.
Address this by tracking when a resize effect is pending, and complete
the effect when appropriate.
Florian Müllner [Fri, 8 Nov 2019 17:00:05 +0000 (18:00 +0100)]
windowManager: Use Sets to track ongoing effects
We only care whether an effect is ongoing for an actor, not about
any particular order. Sets are more convenient than arrays in that
case, so use them instead.
Carlos Garnacho [Thu, 7 Nov 2019 18:06:15 +0000 (19:06 +0100)]
inputMethod: Compare ibus context before processing key event result
In the xwayland-on-demand scenario, it may happen that Xwayland is
shutdown (causing a restart of ibus-daemon to drop ibus-x11) while
we are typing.
If we have a bit of bad luck, this will cause the IBusInputContext
to be disposed (due to its bus "closing") at a time when we have
an ibus_input_context_process_key_event_async() request on the fly.
As the object is disposed in between this would tickle JS (rightfully
complaining that it's been disposed under its feet) and make us pass
an actually NULL IBusInputContext to the corresponding _finish()
function (despite the IBusInputContext being still held alive by some
other refs). This will assert and abort in
ibus_input_context_process_key_event_async_finish() then.
To handle this, listen for IBusInputContext::destroy, and reset our
internal state, this way we can compare on the JS side that the
IBusInputContext is indeed an up-to-date one.
Philip Chimento [Thu, 7 Nov 2019 20:51:28 +0000 (12:51 -0800)]
power: Handle "100% but charging" case
I've observed that UPower can occasionally report a charge level of 100%
while the state is still "charging". This usually doesn't last very long
but it is noticeable because the power icon changes to a "missing icon"
icon. This will handle that rare case correctly.
Florian Müllner [Wed, 6 Nov 2019 19:54:57 +0000 (20:54 +0100)]
ci: Fix checking out mutter on stable branches
For stable branches, we currently only check out the correct mutter
branch for merge requests. For the regular pipeline, our code to
determine the current shell branch fails because CI runs on a
temporary "pipeline/12345" branch that doesn't exist for mutter.
Switching to the correct gitlab environment variable fixes that.
Florian Müllner [Tue, 5 Nov 2019 23:08:04 +0000 (00:08 +0100)]
environment: Stop adding child_set() to layout managers
We no longer use any layout managers that use custom child properties
instead of the generic Clutter.Actor properties, so this override
is completely unused.
Florian Müllner [Tue, 5 Nov 2019 19:37:28 +0000 (20:37 +0100)]
cleanup: Use non-deprecated key symbols
Clutter originally cluttered its namespace with key symbols, before
prefixing all symbols with KEY. We still use the unprefixed symbols
occasionally, replace them so mutter can drop the deprecated symbols.
Jonas Dreßler [Sun, 23 Jun 2019 14:32:29 +0000 (16:32 +0200)]
polkitAgent: Use a timeout for resetting the dialog
Since polkit takes a few milliseconds from initiating the session to
emitting the "request" signal, don't introduce visual distraction by
hiding the password entry and showing it again a few ms later.
So start a timeout of 200 ms when we destroy a session and if no session
request (i.e. a request for a password-authentication) happened during
this timeout, hide the password entry.
Jonas Dreßler [Sun, 23 Jun 2019 14:33:20 +0000 (16:33 +0200)]
polkitAgent: Reset dialog to defaults after cancelling polkit session
Since we don't know if polkit/PAM will request a password (emitting the
"request" signal) or use another authentication method like a
fingerprint after the current authentication failed, hide the password
field and make the "Authenticate" button insensitive after cancelling
the session, just like we do when creating the dialog.
Jonas Dreßler [Mon, 24 Jun 2019 10:36:47 +0000 (12:36 +0200)]
polkitAgent: Make authenticate button insensitive if password is empty
According to the mockups, make the polkit dialogs "Authenticate" button
insensitive and don't respond to pressing the enter key if no password
is supplied.
Jonas Dreßler [Mon, 24 Jun 2019 08:57:24 +0000 (10:57 +0200)]
polkitAgent: Only set key focus to password entry after opening dialog
Set the key focus to the password field only after we got a request
(and therefore know that a password is requested) instead of using
`setInitialKeyFocus()`. This way we don't try to focus the password
field by default if we aren't showing it (e.g. in case the user has no
password or is using fingerprint login).
Also we have to move the call to `grab_key_focus()` to happen after
`_ensureOpen()`, because otherwise the ModalDialog will set the focus to
one of the buttons while opening itself.
Jonas Dreßler [Sun, 23 Jun 2019 10:15:12 +0000 (12:15 +0200)]
polkitAgent: Also show user avatar for root user
Show the user avatar for all users, including the root user. The root
user will always have the generic avatar, but it looks more consistent
than showing no avatar at all.
This way we also don't have to worry about the spacing introduced by the
polkit-dialog-user-layout CSS class, which would give the
"Administrator" label a small offset to the left.
Jonas Dreßler [Sun, 23 Jun 2019 09:52:54 +0000 (11:52 +0200)]
polkitAgent: Update user name on user changes
Right now we only update the user avatar on the user-changed signal, but
since we also display the users real name we should also update that if
the user changes.
Carlos Garnacho [Thu, 24 Oct 2019 12:03:12 +0000 (14:03 +0200)]
st: Track stylesheet changes on the StThemeContext
Instead of every individual StThemeNode. There are essentially two kinds
of theme nodes: Those we create for lookups, and those interned by the
theme context and used by StWidgets. Listening to the signal on the former
is pointless as they are short lived and not meant to be really used for
drawing. So it is only essential to track stylesheet changes in those we
intern for later use.
This change does precisely that, it lets the StThemeContext track the
stylesheet changes and let all known theme nodes reset their state for
it.
The internal array holding all connected handlers for this signal in glib
was about the biggest single allocation made in gnome-shell, as interned
theme nodes nodes are around the 4 to 5 digit numbers. This essentially
makes it disappear.
This however means that widgets that are explicitly set a theme through
st_widget_set_theme() don't get their theme node implicitly updated.
There's little reasons to use that API, so perhaps this is an acceptable
tradeoff.
Carlos Garnacho [Tue, 5 Nov 2019 10:45:36 +0000 (11:45 +0100)]
st: Drop StWidget theme overriding API
A StWidget could get its style from a) a theme set in the StThemeContext,
and b) directly through it's ::theme property. Generally, overriding CSS
through the latter cannot be recommended as it loses any connection with
the global theme (eg. the ones you get through selector specificity).
It sounds a bit too powerful and pervasive, there's no use for it in
gnome-shell and doesn't look like something that could be recommended on
extensions. So, just drop this piece of API.
Florian Müllner [Tue, 29 Oct 2019 18:21:21 +0000 (19:21 +0100)]
cleanup: Use more template strings
xgettext got better at recognizing template strings, so we can
replace more string concatenations. Alas xgettext is still buggy
(surprise, regular expressions are hard), so there are still a
handful of holdouts that prevent us from making a complete switch.
Florian Müllner [Thu, 17 Oct 2019 21:27:27 +0000 (23:27 +0200)]
st/bin: Use child's align properties
By now, all containers and layout managers except StBin (and its
subclasses) use the generic ClutterActor expand/align properties
to control how their children are laid out.
This is particularly confusing as two or the properties StBin uses
for layout - x-align and y-align - shadow the generic ClutterActor
ones, but work very differently: They use a different enum and
determine how the bin lays out its child, instead of how the bin
is laid out by its parent.
Address this by deprecating the StBin properties and using the same
generic ClutterActor properties as everyone else.
Florian Müllner [Mon, 21 Oct 2019 18:44:00 +0000 (20:44 +0200)]
js: Replace child properties
Every since commit aa394754, StBoxLayout has supported ClutterActor's
expand/align properties in addition to the container-specific child
properties. Given that that's the only container left with a special
child meta, it's time to fully embrace the generic properties (and
eventually remove the child meta).
Carlos Garnacho [Fri, 1 Nov 2019 19:01:31 +0000 (20:01 +0100)]
padOsd: Add missing 'closed' signal
This wasn't added on the GObject-ification in commit c4c5c4fd5c. This
introduced warnings and misbehaviors when closing the dialog. (Eg.
pressing the "show OSD" pad action would show stack different dialogs
on top each other).